home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Development Libraries
/
SGI IRIX 6.2 Development Libraries.iso
/
dist
/
complib.idb
/
usr
/
share
/
catman
/
p_man
/
cat3
/
complib
/
cscal2d.z
/
cscal2d
Wrap
Text File
|
1996-03-14
|
7KB
|
133 lines
ccccssssccccaaaallll2222dddd,,,,zzzzssssccccaaaallll2222dddd((((3333FFFF)))) ccccssssccccaaaallll2222dddd,,,,zzzzssssccccaaaallll2222dddd((((3333FFFF))))
NNNNAAAAMMMMEEEE
ccccssssccccaaaallll2222dddd,,,, zzzzssssccccaaaallll2222dddd ---- scales a 2D complex sequence.
SSSSYYYYNNNNOOOOPPPPSSSSYYYYSSSS
_F_o_r_t_r_a_n :
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ccccssssccccaaaallll2222dddd(((( nnnn1111,,,, nnnn2222,,,, aaaallllpppphhhhaaaa,,,, aaaarrrrrrrraaaayyyy,,,, llllddddaaaa))))
iiiinnnntttteeeeggggeeeerrrr nnnn1111,,,, nnnn2222,,,, llllddddaaaa
rrrreeeeaaaallll aaaallllpppphhhhaaaa
ccccoooommmmpppplllleeeexxxx aaaarrrrrrrraaaayyyy((((llllddddaaaa,,,,nnnn2222))))
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee zzzzssssccccaaaallll2222dddd(((( nnnn1111,,,, nnnn2222,,,, aaaallllpppphhhhaaaa,,,, aaaarrrrrrrraaaayyyy,,,, llllddddaaaa))))
iiiinnnntttteeeeggggeeeerrrr nnnn1111,,,, nnnn2222,,,, llllddddaaaa
rrrreeeeaaaallll****8888 aaaallllpppphhhhaaaa
ddddoooouuuubbbblllleeee ccccoooommmmpppplllleeeexxxx aaaarrrrrrrraaaayyyy((((llllddddaaaa,,,,nnnn2222))))
_C :
####iiiinnnncccclllluuuuddddeeee <<<<fffffffftttt....hhhh>>>>
iiiinnnntttt ccccssssccccaaaallll2222dddd((((iiiinnnntttt nnnn1111,,,,iiiinnnntttt nnnn2222,,,,ffffllllooooaaaatttt aaaallllpppphhhhaaaa,,,,
ccccoooommmmpppplllleeeexxxx ****aaaarrrrrrrraaaayyyy,,,,iiiinnnntttt llllddddaaaa))));;;;
iiiinnnntttt zzzzssssccccaaaallll2222dddd((((iiiinnnntttt nnnn1111,,,,iiiinnnntttt nnnn2222,,,,ddddoooouuuubbbblllleeee aaaallllpppphhhhaaaa,,,,
zzzzoooommmmpppplllleeeexxxx ****aaaarrrrrrrraaaayyyy,,,,iiiinnnntttt llllddddaaaa))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
ccccssssccccaaaallll2222dddd and zzzzssssccccaaaallll2222dddd scale a 2D complex sequence of size N1xN2.
The Fourier Transforms are not normalized so the succession Direct-
Inverse transform scales the input data by a factor equal to the size of
the transform. So ccccssssccccaaaallll2222dddd or zzzzssssccccaaaallll2222dddd may be used to scale back the
result.
PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
NNNN1111 ---- Integer, the first dimension size of the 2D sequence.
Unchanged on exit.
NNNN2222 ---- Integer, the second dimension size of the 2D sequence.
Unchanged on exit.
AAAAllllpppphhhhaaaa ---- scaling floating point value.
AAAARRRRRRRRAAAAYYYY ---- Array containing the samples of the 2D sequence to be
transformed.
On input, the element {i,j} of the sequence is stored as A(i,j) in
_F_o_r_t_r_a_n , and A[i+j*lda] in _C.
On exit, the array is overwritten by its transform. LLLLDDDDAAAA ---- Integer,
leading dimension: increment between the samples of two consecutive sub-
sequences (e.g between {i,j+1} and {i,j}).
Unchanged on exit.
EEEExxxxaaaammmmpppplllleeee ooooffff CCCCaaaalllllllliiiinnnngggg SSSSeeeeqqqquuuueeeennnncccceeee
Given a 2D complex sequence of size 64x1024. We successively apply a
Direct Fourier Transform, an Inverse Fourier Transform and finally scale
back the result by a factor 1/N (1/(64*1024.))-
PPPPaaaaggggeeee 1111
ccccssssccccaaaallll2222dddd,,,,zzzzssssccccaaaallll2222dddd((((3333FFFF)))) ccccssssccccaaaallll2222dddd,,,,zzzzssssccccaaaallll2222dddd((((3333FFFF))))
This succession DirectFFT-InverseFFT-Scaling is equivalent to the
identity operator and the final sequence should be equal (with round-off
precision) to the initial sequence.
The offset between the first element of two succesive sub-sequence
(leading dimension) is 2049.
_F_o_r_t_r_a_n
complex array(0:2049-1,0:64-1), coeff(1024+64+2*15)
call cfft2di( 1024, coeff)
call cfft2d( -1, 1024, 64, array, 2049, coeff)
call cfft2d( 1, 1024, 64, array, 2049, coeff)
call cscal2d(1024,64,(1./real(1024*64)),array,2049)
_C
#include <fft.h>
complex array[64*2049], *coeff;
coeff = cfft2di( 1024, NULL);
cfft2d( -1, 1024, 64, array, 2049, coeff);
cfft2d( 1, 1024, 64, array, 2049, coeff);
cscal2d( 1024,64,1./(float)(1024*64),array,2049);
NNNNOOOOTTTTEEEE____1111 :::: The Direct and Inverse transforms should use opposite signs -
Which one is used (+1 or -1) for Direct transform is just a matter of
convention-
NNNNOOOOTTTTEEEE____2222 :::: The Fourier Transforms are not normalized so the succession
Direct-Inverse transform scales the input data by a factor equal to the
size of the transform.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
fft, cfft2di, zfft2di, cfft2d, zfft2d, cprod2d, zprod2d
PPPPaaaaggggeeee 2222